home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / include / agg_ext.h next >
C/C++ Source or Header  |  1992-01-23  |  3KB  |  63 lines

  1. /* --------------------------------------------------------------------------
  2.  * Copyright 1992 by Forschungszentrum Informatik (FZI)
  3.  *
  4.  * You can use and distribute this software under the terms of the licence
  5.  * you should have received along with this program.
  6.  * If not or if you want additional information, write to
  7.  * Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  8.  * D-7500 Karlsruhe 1, Germany.
  9.  * --------------------------------------------------------------------------
  10.  */
  11. #ifndef AGGREGATEH
  12. #define AGGREGATEH 1
  13.  
  14. sos_Bool agg_same_entity (sos_Object,sos_Object,sos_Bool,sos_Eq_kind);
  15.  
  16. // ****************************** agg_iterate ****************************** 
  17. #define agg_iterate(s, e) \
  18. {sos_Cursor _agg_cursor = s.open_cursor(); \
  19.  for (sos_Bool _agg_valid = s.is_valid (_agg_cursor); \
  20.       _agg_valid; \
  21.       _agg_valid = s.to_succ (_agg_cursor)) \
  22.  { e = s.get(_agg_cursor);
  23.  
  24. #define agg_iterate_end(s, e) } s.close_cursor (_agg_cursor);}
  25.  
  26. // ************************** agg_iterate_reverse *************************** 
  27. #define agg_iterate_reverse(s, e) \
  28. { sos_Cursor _agg_cursor = s.open_cursor(); \
  29.   s.to_last(_agg_cursor); \
  30.   for (sos_Bool _agg_valid = s.is_valid (_agg_cursor); \
  31.        _agg_valid; \
  32.        _agg_valid = s.to_pred (_agg_cursor)) \
  33.   { e = s.get(_agg_cursor);
  34.  
  35. #define agg_iterate_reverse_end(s, e) } s.close_cursor (_agg_cursor);}
  36.  
  37. // *************************** agg_iterate_double ************************** 
  38. #define agg_iterate_double(s1, e1, s2, e2, comp) \
  39. { sos_Cursor _agg_cursor1=s1.open_cursor(); \
  40.   sos_Cursor _agg_cursor2=s2.open_cursor(); \
  41.   sos_Bool _agg_valid1, _agg_valid2; comp; \
  42.   for (_agg_valid1=s1.is_valid(_agg_cursor1),_agg_valid2=s2.is_valid(_agg_cursor2); \
  43.        _agg_valid1 && _agg_valid2; \
  44.        _agg_valid1=s1.to_succ(_agg_cursor1),_agg_valid2=s2.to_succ(_agg_cursor2)) \
  45.   { e1 = s1.get(_agg_cursor1); e2 = s2.get(_agg_cursor2);
  46.  
  47. #define agg_iterate_double_end(s1, e1, s2, e2, comp) } \
  48.   comp=(int(_agg_valid1)-int(_agg_valid2)); \
  49.   s1.close_cursor (_agg_cursor1); s2.close_cursor (_agg_cursor2);}
  50.  
  51. // ************************ agg_iterate_association ************************ 
  52. #define agg_iterate_association(s, e1, e2) \
  53. { sos_Cursor _agg_cursor = s.open_cursor(); \
  54.   for (sos_Bool _agg_valid = s.is_valid (_agg_cursor); \
  55.        _agg_valid; \
  56.        _agg_valid = s.to_succ (_agg_cursor)) \
  57.   { e1 = s.get_role1(_agg_cursor); \
  58.     e2 = s.get_role2(_agg_cursor);
  59.  
  60. #define agg_iterate_association_end(s, e1, e2) } s.close_cursor (_agg_cursor);}
  61.  
  62. #endif
  63.